NOTE: PROCEDURE PRINTTO used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

3    
4    DM "log; clear; ";
5    DM 'odsresults; clear';
6    
7    %global projectrootdirectory;
8    %let projectrootdirectory=C:/Users/hpham13/Projects/mf_activism/empirical;
9    
10   *Creates your local Libraries;
11   libname rawdata "&projectrootdirectory./0_input/original";
NOTE: Libref RAWDATA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Projects\mf_activism\empirical\0_input\original
12   libname rawdata2 "&projectrootdirectory./0_input/original/finaldatadepvars";
NOTE: Libref RAWDATA2 was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: 
      C:\Users\hpham13\Projects\mf_activism\empirical\0_input\original\finaldatadepvars
13   libname save "&projectrootdirectory./0_input/final";
NOTE: Libref SAVE was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\Projects\mf_activism\empirical\0_input\final
14   
15   %let datadirectory= C:/Users/hpham13/data ;
16   
17   libname lnk "&datadirectory./Linking_tables/";
NOTE: Libref LNK was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\Linking_tables
18   libname ceo "&datadirectory./ceo/";
NOTE: Libref CEO was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\ceo
19   libname activism "&datadirectory./activism/" ;
NOTE: Libref ACTIVISM was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\activism
20   libname comp "&datadirectory./compustat/fundq/";
NOTE: Libref COMP was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\compustat\fundq
21   libname compa "&datadirectory./compustat/funda/";
NOTE: Libref COMPA was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\compustat\funda
22   libname ibes "&datadirectory./IBES";
NOTE: Libref IBES was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\hpham13\data\IBES
23   
24   * include some macros;
25   %include "&datadirectory./utils/do_over.sas";
332  %include "&datadirectory./utils/ff48.sas";
404  %include "&datadirectory./utils/ff49.sas";
477  %include "&datadirectory./utils/ff12.sas";
516  %include "&datadirectory./utils/winsorize.sas";
604   %include "&datadirectory./utils/lags.sas";
783   
784   
785   /* ************************************************************************ */
786   /* ***********************  PART 1: IMPORT DATA  ************************** */
787   /* ************************************************************************ */
788   %let fname  = 111624_mff_1;         * cutoff 1.0% ;
789   %let fname2 = 111624_mff_2;         * cutoff 2.0% ;
790   %let fname3 = 111624_mff_3;         * cutoff 3.0% ;
791   %let fname4 = 111624_mff_5;         * cutoff 5.0% ;
792   %let fname5 = 080825_mff_stdized;   * cutoff 1.0% ;
793   %let fname6 = 111624_mff_1n;        * cutoff 1.0% Topx ;
794   %let fname7 = 111624_mff_4;         * cutoff 4.0% ;
795   
796   * cutoff 1%;
797   data stockpick;
798       set   rawdata2.stkpick&fname.;
799       label relstkpick1="RelInformedTrade cutoff 1%" ;
800   run;

NOTE: There were 240430 observations read from the data set RAWDATA2.STKPICK111624_MFF_1.
NOTE: The data set WORK.STOCKPICK has 240430 observations and 26 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

801   
802   * cutoff 2%;
803   data stockpick2;
804       set    rawdata2.stkpick&fname2.;
805       keep   gvkey rdq relstkpick1 avg_stkpick1_all stkpick1_large stkpick1_small
806              mfor numinstlarge  avgmforlarge summforlarge numinstsmall avgmforsmall
806 ! summforsmall ;
807       label  relstkpick1="RelInformedTrade cutoff 2%" ;
808       rename relstkpick1      = relstkpick1_2pct;
809       rename avg_stkpick1_all = avg_stkpick1_all_2pct;
810       rename stkpick1_large   = stkpick1_large_2pct;
811       rename stkpick1_small   = stkpick1_small_2pct;
812       rename mfor = mfor_2pct;
813       rename numinstlarge = numinstlarge_2pct;
814       rename avgmforlarge = avgmforlarge_2pct;
815       rename summforlarge = summforlarge_2pct;
816       rename numinstsmall = numinstsmall_2pct;
817       rename avgmforsmall = avgmforsmall_2pct;
818       rename summforsmall = summforsmall_2pct;
819   run;

NOTE: There were 185704 observations read from the data set RAWDATA2.STKPICK111624_MFF_2.
NOTE: The data set WORK.STOCKPICK2 has 185704 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.11 seconds
      cpu time            0.00 seconds
      

820   
821   * cutoff 3%;
822   data stockpick3;
823       set    rawdata2.stkpick&fname3.;
824       keep   gvkey rdq relstkpick1 avg_stkpick1_all stkpick1_large stkpick1_small
825              mfor numinstlarge  avgmforlarge summforlarge numinstsmall avgmforsmall
825 ! summforsmall;
826       label  relstkpick1="RelInformedTrade cutoff 3%" ;
827       rename relstkpick1      = relstkpick1_3pct;
828       rename avg_stkpick1_all = avg_stkpick1_all_3pct;
829       rename stkpick1_large   = stkpick1_large_3pct;
830       rename stkpick1_small   = stkpick1_small_3pct;
831       rename mfor = mfor_3pct;
832       rename numinstlarge = numinstlarge_3pct;
833       rename avgmforlarge = avgmforlarge_3pct;
834       rename summforlarge = summforlarge_3pct;
835       rename numinstsmall = numinstsmall_3pct;
836       rename avgmforsmall = avgmforsmall_3pct;
837       rename summforsmall = summforsmall_3pct;
838   run;

NOTE: There were 138852 observations read from the data set RAWDATA2.STKPICK111624_MFF_3.
NOTE: The data set WORK.STOCKPICK3 has 138852 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.00 seconds
      

839   
840   * cutoff 5%;
841   data stockpick4;
842       set    rawdata2.stkpick&fname4.;
843       keep   gvkey rdq relstkpick1 avg_stkpick1_all stkpick1_large stkpick1_small
844              mfor numinstlarge  avgmforlarge summforlarge numinstsmall avgmforsmall
844 ! summforsmall ;
845       label  relstkpick1="RelInformedTrade cutoff 5%" ;
846       rename relstkpick1      = relstkpick1_5pct;
847       rename avg_stkpick1_all = avg_stkpick1_all_5pct;
848       rename stkpick1_large   = stkpick1_large_5pct;
849       rename stkpick1_small   = stkpick1_small_5pct;
850       rename mfor = mfor_5pct;
851       rename numinstlarge = numinstlarge_5pct;
852       rename avgmforlarge = avgmforlarge_5pct;
853       rename summforlarge = summforlarge_5pct;
854       rename numinstsmall = numinstsmall_5pct;
855       rename avgmforsmall = avgmforsmall_5pct;
856       rename summforsmall = summforsmall_5pct;
857   run;

NOTE: There were 62079 observations read from the data set RAWDATA2.STKPICK111624_MFF_5.
NOTE: The data set WORK.STOCKPICK4 has 62079 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.00 seconds
      

858   proc sort nodupkey; by gvkey rdq; run;

NOTE: There were 62079 observations read from the data set WORK.STOCKPICK4.
NOTE: 334 observations with duplicate key values were deleted.
NOTE: The data set WORK.STOCKPICK4 has 61745 observations and 13 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

859   
860   * Standardized Informed Trade;
861   data stockpick5;
862       set   rawdata2.stkpick&fname5.;
863       keep  gvkey rdq relstkpick4 avg_stkpick4_all stkpick4_large stkpick4_small ;
864       label relstkpick4="RelInformedTrade Stdized" ;
865   run;

NOTE: There were 240430 observations read from the data set RAWDATA2.STKPICK080825_MFF_STDIZED.
NOTE: The data set WORK.STOCKPICK5 has 240430 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.00 seconds
      

866   proc sort nodupkey; by gvkey rdq; run;

NOTE: There were 240430 observations read from the data set WORK.STOCKPICK5.
NOTE: 1887 observations with duplicate key values were deleted.
NOTE: The data set WORK.STOCKPICK5 has 238543 observations and 6 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.06 seconds
      

867   
868   * Add TopX ownership data ;
869   data stockpick6;
870       set   rawdata2.stkpick&fname6.;
871       keep  gvkey rdq MFOR_top1 MFOR_top2 MFOR_top3 MFOR_top4 MFOR_top5
872             MFOR_top1_cut MFOR_top2_cut MFOR_top3_cut MFOR_top4_cut MFOR_top5_cut;
873   run;

NOTE: There were 240430 observations read from the data set RAWDATA2.STKPICK111624_MFF_1N.
NOTE: The data set WORK.STOCKPICK6 has 240430 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.03 seconds
      

874   proc sort nodupkey; by gvkey rdq; run;

NOTE: There were 240430 observations read from the data set WORK.STOCKPICK6.
NOTE: 1887 observations with duplicate key values were deleted.
NOTE: The data set WORK.STOCKPICK6 has 238543 observations and 12 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.09 seconds
      

875   
876   * cutoff 4%;
877   data stockpick7;
878       set    rawdata2.stkpick&fname7.;
879       keep   gvkey rdq relstkpick1 avg_stkpick1_all stkpick1_large stkpick1_small /*mfor*/
880              numinstlarge  avgmforlarge summforlarge numinstsmall avgmforsmall summforsmall;
881       label  relstkpick1="RelInformedTrade cutoff 4%" ;
882       rename relstkpick1      = relstkpick1_4pct;
883       rename avg_stkpick1_all = avg_stkpick1_all_4pct;
884       rename stkpick1_large   = stkpick1_large_4pct;
885       rename stkpick1_small   = stkpick1_small_4pct;
886       *rename mfor = mfor_4pct;
887       rename numinstlarge = numinstlarge_4pct;
888       rename avgmforlarge = avgmforlarge_4pct;
889       rename summforlarge = summforlarge_4pct;
890       rename numinstsmall = numinstsmall_4pct;
891       rename avgmforsmall = avgmforsmall_4pct;
892       rename summforsmall = summforsmall_4pct;
893   run;

NOTE: There were 99450 observations read from the data set RAWDATA2.STKPICK111624_MFF_4.
NOTE: The data set WORK.STOCKPICK7 has 99450 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.03 seconds
      

894   proc sort nodupkey; by gvkey rdq; run;

NOTE: There were 99450 observations read from the data set WORK.STOCKPICK7.
NOTE: 532 observations with duplicate key values were deleted.
NOTE: The data set WORK.STOCKPICK7 has 98918 observations and 12 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

895   
896   * Merge all datasets;
897   proc sql;
898       create table stockpick as
899       select a.*, b.*, c.*,d.*,e.*,f.*,g.*
900       from stockpick as a
901       left join stockpick2 as b on a.gvkey=b.gvkey and a.rdq=b.rdq
902       left join stockpick3 as c on a.gvkey=c.gvkey and a.rdq=c.rdq
903       left join stockpick4 as d on a.gvkey=d.gvkey and a.rdq=d.rdq
904       left join stockpick5 as e on a.gvkey=e.gvkey and a.rdq=e.rdq
905       left join stockpick6 as f on a.gvkey=f.gvkey and a.rdq=f.rdq
906       left join stockpick7 as g on a.gvkey=g.gvkey and a.rdq=g.rdq ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.STOCKPICK.
WARNING: Variable rdq already exists on file WORK.STOCKPICK.
WARNING: Variable gvkey already exists on file WORK.STOCKPICK.
WARNING: Variable rdq already exists on file WORK.STOCKPICK.
WARNING: Variable gvkey already exists on file WORK.STOCKPICK.
WARNING: Variable rdq already exists on file WORK.STOCKPICK.
WARNING: Variable gvkey already exists on file WORK.STOCKPICK.
WARNING: Variable rdq already exists on file WORK.STOCKPICK.
WARNING: Variable gvkey already exists on file WORK.STOCKPICK.
WARNING: Variable rdq already exists on file WORK.STOCKPICK.
WARNING: Variable gvkey already exists on file WORK.STOCKPICK.
WARNING: Variable rdq already exists on file WORK.STOCKPICK.
NOTE: Table WORK.STOCKPICK created, with 246752 rows and 83 columns.

907   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.65 seconds
      cpu time            0.73 seconds
      

908   
909   * drop unneccessary vars;
910   data stockpick; set stockpick;
911       drop mfor mfor_2pct mfor_3pct mfor_5pct;
912   run;

NOTE: There were 246752 observations read from the data set WORK.STOCKPICK.
NOTE: The data set WORK.STOCKPICK has 246752 observations and 79 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.09 seconds
      

913   
914   data stockpick; set stockpick;
915       format relstkpick1 relstkpick1_2pct relstkpick1_3pct relstkpick1_5pct
916       relstkpick2 stkpick1 stkpick2 avg_stkpick1_all avg_stkpick2_all
917       stkpick1_Large stkpick1_Small comma8.5;
918   run;

NOTE: There were 246752 observations read from the data set WORK.STOCKPICK.
NOTE: The data set WORK.STOCKPICK has 246752 observations and 79 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.09 seconds
      

919   proc sort nodupkey; by gvkey rdq; run;

NOTE: There were 246752 observations read from the data set WORK.STOCKPICK.
NOTE: 8209 observations with duplicate key values were deleted.
NOTE: The data set WORK.STOCKPICK has 238543 observations and 79 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.13 seconds
      cpu time            0.17 seconds
      

920   
921   /* merge corhot data and others */
922   data _stacked_data; set rawdata.stacked_data_111624; run;

NOTE: There were 50730 observations read from the data set RAWDATA.STACKED_DATA_111624.
NOTE: The data set WORK._STACKED_DATA has 50730 observations and 52 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.00 seconds
      

923   
924   * Add campaign id for control firms;
925   data pop_campaign; set rawdata.pop_campaign; run;

NOTE: There were 5794 observations read from the data set RAWDATA.POP_CAMPAIGN.
NOTE: The data set WORK.POP_CAMPAIGN has 5794 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

926   
927   proc sql;
928       create table stacked_data as
929       select a.*, b.POP_CAMPAIGN_ID
930       from _stacked_data a left join pop_campaign b
931       on a.gvkey=b.gvkey and a.pairid=b.pairid;
NOTE: Table WORK.STACKED_DATA created, with 50730 rows and 53 columns.

932   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.07 seconds
      

933   
934   proc sort data=stacked_data; by cid pairid treated qd; run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 53 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

935   
936   /* handle outliers market capitalizationmkvaltq */
937   data stacked_data;
938       set stacked_data;
939       fyear = year(datadate);
940       mkvaltq3 = min(mkvaltq, prccq*cshoq) ;
941   run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      135 at 940:16   386 at 940:34   
NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 55 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

942   
943   proc sql;
944       create table stacked_data as
945       select  *, max(year(ANNOUNCE_DATE)) as pop_year
946       from    stacked_data
947       group   by cid, pairid
948       order   by cid, pairid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Invalid (or missing) arguments to the YEAR function have caused the function to return a 
      missing value.
NOTE: Table WORK.STACKED_DATA created, with 50730 rows and 56 columns.

949   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.06 seconds
      cpu time            0.09 seconds
      

950   
951   * Winsorize mkt cap;
952   %let winvars = mkvaltq3 ;
953   %let outvar = mkvaltq4 ;
954   %let byvar = fyear ;
955   %let hi = 99 ;
956   %let lo = 1 ;
957   
958   * Compute p_1 and p_99;
959   proc sort data=stacked_data; by &byvar. ; run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 56 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

960   proc univariate data=stacked_data noprint;
NOTE: Writing HTML Body file: sashtml.htm
961       var &winvars. ;
962       by &byvar.;
963       output out=winsor_bounds pctlpts=&lo. &hi. pctlpre=p_;
964   run;

NOTE: The data set WORK.WINSOR_BOUNDS has 28 observations and 3 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           0.32 seconds
      cpu time            0.15 seconds
      

965   * Find maximum x < p_99 for each year;
966   proc sql;
967       create table below_p&hi. as
968       select a.&byvar., max(&winvars.) as cap_value_p&hi.
969       from stacked_data a
970       inner join winsor_bounds b
971       on a.&byvar. = b.&byvar.
972       where a.&winvars. < b.p_&hi.
973       group by a.&byvar. ;
NOTE: Table WORK.BELOW_P99 created, with 28 rows and 2 columns.

974   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

975   
976   * Merge everything;
977   proc sort data=stacked_data; by &byvar.; run;

NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

978   proc sort data=winsor_bounds; by &byvar.; run;

NOTE: There were 28 observations read from the data set WORK.WINSOR_BOUNDS.
NOTE: The data set WORK.WINSOR_BOUNDS has 28 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

979   proc sort data=below_p&hi.; by &byvar.; run;

NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

980   
981   data stacked_data;
982       merge stacked_data winsor_bounds below_p&hi.;
983       by &byvar.;
984   run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: There were 28 observations read from the data set WORK.WINSOR_BOUNDS.
NOTE: There were 28 observations read from the data set WORK.BELOW_P99.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 59 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

985   
986   * Replace all x = p_99 with cap value ;
987   data stacked_data;
988       set stacked_data;
989       &outvar. = &winvars.;
990       if &winvars. < p_&lo. then &outvar. = p_&lo.;
991       else if &winvars. >= p_&hi. then &outvar. = cap_value_p&hi. ;
992   run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 60 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.03 seconds
      

993   
994   data stacked_data;
995       set stacked_data;
996       drop fyear;
997   run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 59 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

998   
999   * make the cohort year;
1000  data stacked_data; set stacked_data;
1001      if qd_rel = 0 then _cohort_y = fyearq; else _cohort_y = 0;
1002  run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 60 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1003  proc sql;
1004      create table stacked_data as
1005      select *, max(_cohort_y) as cohort_y label='Cohort Year'
1006      from stacked_data
1007      group by cid ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.STACKED_DATA created, with 50730 rows and 61 columns.

1008  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.06 seconds
      

1009  data stacked_data; set stacked_data;
1010      drop _cohort_y ;
1011  run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 60 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1012  proc sort data=stacked_data; by cid pairid treated qd_rel; run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA.
NOTE: The data set WORK.STACKED_DATA has 50730 observations and 60 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

1013  
1014  
1015  /* Activism data */
1016  data pilot; set activism.ca_details_95_pilot; run;

NOTE: There were 9262 observations read from the data set ACTIVISM.CA_DETAILS_95_PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 147 variables.
NOTE: DATA statement used (Total process time):
      real time           0.17 seconds
      cpu time            0.07 seconds
      

1017  proc sort data=pilot nodupkey; by  gvkey CAMPAIGN_ID ; run;

NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.PILOT has 9262 observations and 147 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.10 seconds
      cpu time            0.10 seconds
      

1018  
1019  * check if two campaigns happens during the period of 8 quarters ;
1020  proc sort data=pilot;
1021      by gvkey ANNOUNCE_DATE;
1022  run;

NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 147 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.10 seconds
      cpu time            0.07 seconds
      

1023  data pilot; set pilot;
1024      by gvkey ;
1025      ANNOUNCE_DATE_l = lag(ANNOUNCE_DATE);
1026      if first.gvkey then ANNOUNCE_DATE_l=.;
1027      format ANNOUNCE_DATE_l YYMMDD10. ;
1028      * count the number of quarters;
1029      days_diff = intck('day', ANNOUNCE_DATE_l, ANNOUNCE_DATE);
1030      if ANNOUNCE_DATE_l = . then days_diff = . ;
1031      if days_diff ne . then quarter_diff = days_diff/30 ;
1032          else quarter_diff = . ;
1033      format quarter_diff comma8.1;
1034  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      4328 at 1029:17   
NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 150 variables.
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.06 seconds
      

1035  
1036  proc sort data=pilot out=pilot;
1037      by gvkey descending ANNOUNCE_DATE;
1038  run;

NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 150 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.10 seconds
      cpu time            0.09 seconds
      

1039  
1040  data pilot;
1041      set pilot;
1042      by gvkey;
1043      retain ANNOUNCE_DATE_f;
1044      if first.gvkey then ANNOUNCE_DATE_f = .;
1045      ANNOUNCE_DATE_f = lag(ANNOUNCE_DATE);
1046      if first.gvkey then ANNOUNCE_DATE_f = .;
1047      output;
1048  run;

NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 151 variables.
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.06 seconds
      

1049  
1050  data pilot;
1051      set pilot;
1052      format ANNOUNCE_DATE_f YYMMDD10. ;
1053      * count the number of quarters;
1054      days_diff_2 = intck('day', ANNOUNCE_DATE, ANNOUNCE_DATE_f);
1055      if ANNOUNCE_DATE = . then days_diff_2 = . ;
1056      if days_diff_2 ne . then quarter_diff_2 = days_diff_2/30 ;
1057          else quarter_diff_2 = . ;
1058      format quarter_diff_2 comma8.1;
1059  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      4328 at 1054:19   
NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 153 variables.
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.07 seconds
      

1060  proc sort data=pilot out=pilot; by gvkey ANNOUNCE_DATE; run;

NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 153 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.10 seconds
      cpu time            0.10 seconds
      

1061  
1062  data pilot; set pilot;
1063      * count the number of days ;
1064      duration  = intck('day', ANNOUNCE_DATE, MEETING_DATE)+1 ;
1065      duration2 = intck('day', ANNOUNCE_DATE, END_DATE)+1;
1066      duration3 = intck('day', FILING_DATE, MEETING_DATE)+1  ;
1067      label duration  = "Ndays btw Announce_date and Meeting_date";
1068      label duration2 = "Ndays btw Announce_date and End_date";
1069      label duration3 = "Ndays btw Filing_date and Meeting_date";
1070  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      5819 at 1064:17   5819 at 1064:58   1412 at 1065:17   1412 at 1065:54   5822 at 1066:17
      5822 at 1066:56   
NOTE: There were 9262 observations read from the data set WORK.PILOT.
NOTE: The data set WORK.PILOT has 9262 observations and 156 variables.
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.07 seconds
      

1071  
1072  proc sql;
1073      create table pilot as
1074      select *, median(duration) as med_duration, median(duration2) as med_duration2
1075      from pilot
1076      group by year(ANNOUNCE_DATE)
1077      order by gvkey, ANNOUNCE_DATE;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.PILOT created, with 9262 rows and 158 columns.

1078  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.23 seconds
      cpu time            0.31 seconds
      

1079  
1080  * other activism data;
1081  data sharkwatch; set activism.tohai_activists_12032023; run;

NOTE: There were 3023 observations read from the data set ACTIVISM.TOHAI_ACTIVISTS_12032023.
NOTE: The data set WORK.SHARKWATCH has 3023 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1082  proc sort data=sharkwatch nodupkey; by CAMPAIGN_ID; run;

NOTE: There were 3023 observations read from the data set WORK.SHARKWATCH.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.SHARKWATCH has 3023 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1083  
1084  * Activist prior experience;
1085  data activist_prior_exp; set rawdata.activist_prior_exp_061725; run;

NOTE: There were 2028 observations read from the data set RAWDATA.ACTIVIST_PRIOR_EXP_061725.
NOTE: The data set WORK.ACTIVIST_PRIOR_EXP has 2028 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1086  %let qd = (year(ANNOUNCE_DATE)*4  + qtr(ANNOUNCE_DATE) - 1925*4);
1087  data activist_prior_exp; set activist_prior_exp ;
1088      if ANNOUNCE_DATE ne . then do ;
1089          qd = &qd;
1090      end;
1091  run;

NOTE: There were 2028 observations read from the data set WORK.ACTIVIST_PRIOR_EXP.
NOTE: The data set WORK.ACTIVIST_PRIOR_EXP has 2028 observations and 21 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1092  proc sort data=activist_prior_exp nodupkey; by gvkey year qd; run;

NOTE: There were 2028 observations read from the data set WORK.ACTIVIST_PRIOR_EXP.
NOTE: 205 observations with duplicate key values were deleted.
NOTE: The data set WORK.ACTIVIST_PRIOR_EXP has 1823 observations and 21 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1093  
1094  * Merge data;
1095  proc sql;
1096      create table stacked_data2 as
1097      select a.*, b.*, c.*,
1098             d.prior_exp,
1099             d.mean_prior_exp_sic2,
1100             d.med_prior_exp_sic2,
1101             d.med_NUMBER_CAMPAIGNS,
1102             d.mean_NUMBER_CAMPAIGNS,
1103             d.med_ACTIVIST_THREAT_RATING,
1104             d.mean_ACTIVIST_THREAT_RATING
1105      from   stacked_data as a left join pilot as b
1106      on     a.gvkey=b.gvkey and
1107             a.FACTSET_ENTITY_ID=b.FACTSET_ENTITY_ID and
1108             a.CAMPAIGN_ID=b.CAMPAIGN_ID
1109      left join sharkwatch as c
1110      on     a.CAMPAIGN_ID=c.CAMPAIGN_ID
1111      left join activist_prior_exp as d
1112      on     a.gvkey=d.gvkey and a.qd=d.qd ;
WARNING: Variable CAMPAIGN_ID already exists on file WORK.STACKED_DATA2.
WARNING: Variable ANNOUNCE_DATE already exists on file WORK.STACKED_DATA2.
WARNING: Variable FILING_DATE already exists on file WORK.STACKED_DATA2.
WARNING: Variable END_DATE already exists on file WORK.STACKED_DATA2.
WARNING: Variable FACTSET_ENTITY_ID already exists on file WORK.STACKED_DATA2.
WARNING: Variable ENTITY_PROPER_NAME already exists on file WORK.STACKED_DATA2.
WARNING: Variable gvkey already exists on file WORK.STACKED_DATA2.
WARNING: Variable CAMPAIGN_ID already exists on file WORK.STACKED_DATA2.
NOTE: Table WORK.STACKED_DATA2 created, with 50730 rows and 222 columns.

1113  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.40 seconds
      cpu time            1.71 seconds
      

1114  proc sort data=stacked_data2 nodupkey; by cID PairID treated qd_rel ; run;

NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA2.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.STACKED_DATA2 has 50730 observations and 222 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.61 seconds
      cpu time            0.60 seconds
      

1115  
1116  * create the SIC2 ;
1117  data stacked_data2;
1118      set stacked_data2;
1119      sic_num = input(sic, 8.);
1120      sic2 = floor(sic/100);
1121  run;

NOTE: Character values have been converted to numeric values at the places given by: 
      (Line):(Column).
      1120:18   
NOTE: There were 50730 observations read from the data set WORK.STACKED_DATA2.
NOTE: The data set WORK.STACKED_DATA2 has 50730 observations and 224 variables.
NOTE: DATA statement used (Total process time):
      real time           0.38 seconds
      cpu time            0.39 seconds
      

1122  
1123  * count the number of campaigns per sic2-year ;
1124  proc sql;
1125      create table stacked_data2 as
1126      select a.*,
1127             b.number_campaigns_ind,
1128             b.avg_campaigns_ind,
1129             b.med_campaigns_ind,
1130             b.sd_campaigns_ind,
1131             b.med_activist_threat_rating,
1132             b.sum_activist_threat_rating,
1133             b.avg_activist_threat_rating
1134      from   stacked_data2 as a
1135      left   join ( select distinct CAMPAIGN_ID, sic2, year,
1136             sum( number_campaigns) as number_campaigns_ind label="N campaigns (industry)",
1137             mean( number_campaigns) as avg_campaigns_ind format comma8.3,
1138             median( number_campaigns) as med_campaigns_ind format comma8.2,
1139             std( number_campaigns) as sd_campaigns_ind format comma8.2,
1140             median(activist_threat_rating) as med_activist_threat_rating format comma8.2,
1141             avg(activist_threat_rating) as avg_activist_threat_rating format comma8.2,
1142             sum(activist_threat_rating) as sum_activist_threat_rating format comma8.2
1143             from stacked_data2
1144             group by sic2, year
1145             having number_campaigns ne . and activist_threat_rating ne . ) as b
1146      on     a.CAMPAIGN_ID=b.CAMPAIGN_ID and
1147             a.sic2=b.sic2 and
1148             a.year=b.year  ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable med_activist_threat_rating already exists on file WORK.STACKED_DATA2.
NOTE: Table WORK.STACKED_DATA2 created, with 50730 rows and 230 columns.

1149  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.22 seconds
      cpu time            1.39 seconds
      

1150  
1151  
1152  * Merge stacked data and MFF informedTradeGap;
1153  proc sql;
1154      create table Analysis as
1155      select a.*, b.*
1156      from   stacked_data2 as a left join stockpick as b
1157      on     a.gvkey=b.gvkey and a.rdq=b.rdq ;
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable datadate already exists on file WORK.ANALYSIS.
WARNING: Variable rdq already exists on file WORK.ANALYSIS.
WARNING: Variable qd already exists on file WORK.ANALYSIS.
WARNING: Variable year already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 50730 rows and 304 columns.

1158  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.00 seconds
      cpu time            1.18 seconds
      

1159  
1160  * Sort the original order;
1161  proc sort data=Analysis nodupkey; by cID PairID treated gvkey datadate; run;

NOTE: There were 50730 observations read from the data set WORK.ANALYSIS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 50730 observations and 304 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.63 seconds
      cpu time            0.64 seconds
      

1162  
1163  * handle outliers after merging all;
1164  data Analysis; set Analysis; fyear=year(datadate); run;

NOTE: There were 50730 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 50730 observations and 305 variables.
NOTE: DATA statement used (Total process time):
      real time           0.43 seconds
      cpu time            0.42 seconds
      

1165  %winsor(dsetin=work.Analysis, dsetout=work.Analysis, byvar=fyear, vars=relstkpick1
1165! relstkpick1_2pct relstkpick1_3pct , type=trim, pctl=1 99);

NOTE: There were 50730 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.XTEMP has 50730 observations and 305 variables.
NOTE: DATA statement used (Total process time):
      real time           0.35 seconds
      cpu time            0.35 seconds
      


NOTE: There were 50730 observations read from the data set WORK.XTEMP.
NOTE: The data set WORK.XTEMP has 50730 observations and 305 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.63 seconds
      cpu time            0.62 seconds
      


NOTE: The data set WORK.XTEMP_PCTL has 28 observations and 7 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           0.12 seconds
      cpu time            0.12 seconds
      


WARNING: The variable xbyvar in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 50730 observations read from the data set WORK.XTEMP.
NOTE: There were 28 observations read from the data set WORK.XTEMP_PCTL.
NOTE: The data set WORK.ANALYSIS has 49762 observations and 305 variables.
NOTE: DATA statement used (Total process time):
      real time           0.40 seconds
      cpu time            0.39 seconds
      

1166  data Analysis; set Analysis; drop fyear ; run;

NOTE: There were 49762 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 49762 observations and 304 variables.
NOTE: DATA statement used (Total process time):
      real time           0.43 seconds
      cpu time            0.40 seconds
      

1167  proc sql;
1167!           drop table xtemp, xtemp_pctl;
NOTE: Table WORK.XTEMP has been dropped.
NOTE: Table WORK.XTEMP_PCTL has been dropped.
1167!                                         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

1168  
1169  
1170  /* ************************************************************************ */
1171  /* **********************  PART 2: QUARTERLY VARIABLES  ******************* */
1172  /* ************************************************************************ */
1173  data fundq_clean;
1174      set rawdata.comp_fundq_clean;
1175      keep gvkey rdq datadate fyearq fyr fqtr be /*me*/ bd ppegtq PnI saleq to dlttq dlcq
1176      oibdpq oiadpq pm ic tacq revq drevq drevadjq ppeq roaq roaq_lag1 me ml bm
1177      atq_lag1 saleq_lag1 rectq_lag1 ibq ibq_lag1 size size_l lvrg_l lvrg seqq ltq niq niq_l
1177! ;
1178      if atq > 0 and atq_lag1 > 0 ;
1179      size   = log(atq);
1180      size_l = log(atq_lag1);
1181      lvrg_l = bd/atq_lag1;
1182      lvrg   = dlttq/atq;
1183      if lvrg eq . then lvrg = 0 ;
1184  run;

WARNING: The variable niq_l in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      227702 at 1181:16   8651 at 1182:19     
NOTE: There were 1125340 observations read from the data set RAWDATA.COMP_FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 40 variables.
NOTE: DATA statement used (Total process time):
      real time           2.63 seconds
      cpu time            0.29 seconds
      

1185  * Sort again to get the original order;
1186  proc sort data=fundq_clean nodupkey; by gvkey datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 40 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.26 seconds
      cpu time            0.43 seconds
      

1187  
1188  * handle outliers firm chars;
1189  %let winsVars2 = saleq revq ;
1190  %winsor(dsetin=work.fundq_clean, dsetout=work.fundq_clean, byvar=fyearq, vars=&winsVars2,
1190! type=winsor, pctl=1 99);

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.XTEMP has 1012247 observations and 40 variables.
NOTE: DATA statement used (Total process time):
      real time           0.16 seconds
      cpu time            0.15 seconds
      


NOTE: There were 1012247 observations read from the data set WORK.XTEMP.
NOTE: The data set WORK.XTEMP has 1012247 observations and 40 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.27 seconds
      cpu time            0.48 seconds
      


NOTE: The data set WORK.XTEMP_PCTL has 30 observations and 5 variables.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
      real time           0.72 seconds
      cpu time            0.73 seconds
      


WARNING: The variable xbyvar in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 1012247 observations read from the data set WORK.XTEMP.
NOTE: There were 30 observations read from the data set WORK.XTEMP_PCTL.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 40 variables.
NOTE: DATA statement used (Total process time):
      real time           0.23 seconds
      cpu time            0.21 seconds
      

1191  
1192  * get more fundq vars;
1193  data fundq_add; set comp.fundq_1950_2021;
1194      keep gvkey datadate intanq ;
1195      where datadate>'01JAN1990'd;
1196  run;

NOTE: There were 1441077 observations read from the data set COMP.FUNDQ_1950_2021.
      WHERE datadate>'01JAN1990'D;
NOTE: The data set WORK.FUNDQ_ADD has 1441077 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.29 seconds
      cpu time            0.28 seconds
      

1197  
1198  proc sort data=fundq_add nodupkey; by gvkey datadate; run;

NOTE: There were 1441077 observations read from the data set WORK.FUNDQ_ADD.
NOTE: 1238 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDQ_ADD has 1439839 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.07 seconds
      cpu time            0.23 seconds
      

1199  proc sort data=fundq_clean nodupkey; by gvkey datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 40 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.26 seconds
      cpu time            0.45 seconds
      

1200  data fundq_clean;
1201      merge fundq_clean(in=a) fundq_add (in=b);
1202      by gvkey datadate;
1203      if a;
1204  run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: There were 1439839 observations read from the data set WORK.FUNDQ_ADD.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 41 variables.
NOTE: DATA statement used (Total process time):
      real time           0.28 seconds
      cpu time            0.28 seconds
      

1205  
1206  * Create calendar date of fiscal period end in Compustat extract;
1207  data fundq_clean; set fundq_clean;
1208     if (1<=fyr<=5) then date_fyend=intnx('month',mdy(fyr,1,fyearq+1),0,'end');
1209     else if (6<=fyr<=12) then date_fyend=intnx('month',mdy(fyr,1,fyearq),0,'end');
1210     fqenddt=intnx('month',date_fyend,-3*(4-fqtr),'end');
1211     format fqenddt date9.;
1212     drop date_fyend;
1213  run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 42 variables.
NOTE: DATA statement used (Total process time):
      real time           0.45 seconds
      cpu time            0.45 seconds
      

1214  
1215  * calculate moving sum of quarterly loss;
1216  data fundq_clean; set fundq_clean;
1217      if niq <=0 then lossq = 1 ; else lossq = 0;
1218  run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 43 variables.
NOTE: DATA statement used (Total process time):
      real time           0.19 seconds
      cpu time            0.20 seconds
      

1219  
1220  proc sort data=fundq_clean; by gvkey datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 43 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.27 seconds
      cpu time            0.45 seconds
      

1221  proc expand data=fundq_clean out=fundq_clean;
1222      by gvkey ;
1223      id datadate;
1224      convert lossq = sum_lossq12 / transformout=(movsum 16);
1225      convert niq = ma_niq12 / transformout=(movave 16);
1226      convert ibq = sd_niq12 / transformout=(movstd 16);
1227      convert roaq = sd_roaq12 / transformout=(movstd 16);
1228  run;

WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable ibq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable roaq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=009879
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable ibq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable roaq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=010673
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable ibq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable roaq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=013260
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable ibq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable roaq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=013530
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable ibq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable roaq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=013938
WARNING: The variable niq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable ibq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
WARNING: The variable roaq has only 0 nonmissing observations, which is too few to apply the 
         conversion method. The result series is set to missing.
NOTE: The above message was for the following BY group:
      Global Company Key=060976
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 47 variables.
NOTE: PROCEDURE EXPAND used (Total process time):
      real time           1.47 seconds
      cpu time            1.43 seconds
      

1229  data fundq_clean; set fundq_clean; drop datadate; run;

NOTE: There were 1012247 observations read from the data set WORK.FUNDQ_CLEAN.
NOTE: The data set WORK.FUNDQ_CLEAN has 1012247 observations and 46 variables.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.20 seconds
      

1230  
1231  
1232  /* ************************************************************************ */
1233  /* ***********************  PART 3: ANNUAL VARIABLES  ********************* */
1234  /* ************************************************************************ */
1235  data funda_clean;
1236      set rawdata.comp_funda_clean2020;
1237      if at>0 & at_l>0;
1238      asize   = log(at);
1239      asize_l = log(at_l);
1240      bm_ann = bm;
1241      roa2 = ib_l/at_l;
1242      if ni < 0 then loss_a = 1; else loss_a = 0;
1243      where datadate ne . and at>0;
1244      label asize = "Log(AT)"
1245      asize_l = "Log(AT_l)" ;
1246      drop conm cusip ajex fyr ;
1247      drop be me bd PnI to pm ic ;
1248  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      272 at 1241:16   
NOTE: There were 182044 observations read from the data set RAWDATA.COMP_FUNDA_CLEAN2020.
      WHERE (datadate not = .) and (at>0);
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 107 variables.
NOTE: DATA statement used (Total process time):
      real time           0.50 seconds
      cpu time            0.06 seconds
      

1249  proc sort data=funda_clean nodupkey ; by gvkey fyear; run;

NOTE: There were 181286 observations read from the data set WORK.FUNDA_CLEAN.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FUNDA_CLEAN has 181286 observations and 107 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.14 seconds
      cpu time            0.20 seconds
      

1250  
1251  * firm_age;
1252  data firm_age;
1253      set rawdata.firm_age;
1254  run;

NOTE: There were 340705 observations read from the data set RAWDATA.FIRM_AGE.
NOTE: The data set WORK.FIRM_AGE has 340705 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.00 seconds
      

1255  proc sort data=firm_age nodupkey; by gvkey fyear; run;

NOTE: There were 340705 observations read from the data set WORK.FIRM_AGE.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.FIRM_AGE has 340705 observations and 5 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.10 seconds
      

1256  
1257  proc sql;
1258      create table funda_clean as
1259      select a.*, b.firm_age, b.firm_age_max
1260      from funda_clean a
1261      left join firm_age b
1262      on a.gvkey=b.gvkey and a.fyear=b.fyear;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.FUNDA_CLEAN created, with 181286 rows and 109 columns.

1263  run;
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.
1264  
1265  * Calculate the mean, median, and standard deviation by industry  ;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.17 seconds
      cpu time            0.17 seconds
      

1266  proc sql;
1267      create table funda_clean as
1268      select *,
1269             mean(firm_age) as ind_mean_firm_age label="Industry mean firm age",
1270             median(firm_age) as ind_med_firm_age label="Industry median firm age",
1271             std(firm_age) as ind_std_firm_age label="Industry Std firm age"
1272      from   funda_clean
1273      group  by sic2, fyear
1274      order  by gvkey, fyear;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.FUNDA_CLEAN created, with 181286 rows and 112 columns.

1275  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.32 seconds
      cpu time            0.43 seconds
      

1276  
1277  * accruals;
1278  data accruals; set rawdata.accruals; run;

NOTE: There were 209596 observations read from the data set RAWDATA.ACCRUALS.
NOTE: The data set WORK.ACCRUALS has 209596 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           0.11 seconds
      cpu time            0.00 seconds
      

1279  proc sort data=accruals nodupkey; by gvkey fyear; run;

NOTE: There were 209596 observations read from the data set WORK.ACCRUALS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ACCRUALS has 209596 observations and 11 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1280  data accruals_quality; set rawdata.accruals_quality; run;

NOTE: There were 140946 observations read from the data set RAWDATA.ACCRUALS_QUALITY.
NOTE: The data set WORK.ACCRUALS_QUALITY has 140946 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.01 seconds
      

1281  proc sort data=accruals_quality nodupkey; by gvkey fyear; run;

NOTE: There were 140946 observations read from the data set WORK.ACCRUALS_QUALITY.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ACCRUALS_QUALITY has 140946 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.06 seconds
      

1282  
1283  * EPS Rolling Std ;
1284  data eps_rolling_std; set rawdata.eps_rolling_std; run;

NOTE: There were 71628 observations read from the data set RAWDATA.EPS_ROLLING_STD.
NOTE: The data set WORK.EPS_ROLLING_STD has 71628 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds
      

1285  proc sort data=eps_rolling_std nodupkey; by gvkey fyear; run;

NOTE: There were 71628 observations read from the data set WORK.EPS_ROLLING_STD.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.EPS_ROLLING_STD has 71628 observations and 13 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1286  
1287  * intangible ;
1288  data intangibles; set rawdata.intangibles; run;

NOTE: There were 69516 observations read from the data set RAWDATA.INTANGIBLES.
NOTE: The data set WORK.INTANGIBLES has 69516 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds
      

1289  proc sort data=accruals nodupkey; by gvkey fyear; run;

NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1290  
1291  * rem ;
1292  data rem; set rawdata.rem; run;

NOTE: There were 183734 observations read from the data set RAWDATA.REM.
NOTE: The data set WORK.REM has 183734 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds
      

1293  proc sort data=rem nodupkey; by gvkey fyear; run;

NOTE: There were 183734 observations read from the data set WORK.REM.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.REM has 183734 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds
      

1294  
1295  * cfo vol  ;
1296  data cfo_rolling_std; set rawdata.cfo_rolling_std; run;

NOTE: There were 65008 observations read from the data set RAWDATA.CFO_ROLLING_STD.
NOTE: The data set WORK.CFO_ROLLING_STD has 65008 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds
      

1297  proc sort data=cfo_rolling_std nodupkey; by gvkey fyear; run;

NOTE: There were 65008 observations read from the data set WORK.CFO_ROLLING_STD.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CFO_ROLLING_STD has 65008 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1298  
1299  * merge additional annual variables;
1300  proc sql;
1301      create table funda_clean as
1302      select a.*,
1303             d.epspx_std_10, d.epsfx_std_10, d.eps_std_10,
1304             e.intan1, e.intan2, e.intan3, e.intan4,
1305             f.rem1, f.rem2,
1306             g.oancf_std_10
1307      from   funda_clean a
1308      left   join eps_rolling_std d
1309             on a.gvkey=d.gvkey and a.fyear=d.fyear
1310      left   join intangibles e
1311             on a.gvkey=e.gvkey and a.fyear=e.fyear
1312      left   join rem f
1313             on a.gvkey=f.gvkey and a.fyear=f.fyear
1314      left   join cfo_rolling_std g
1315             on a.gvkey=g.gvkey and a.fyear=g.fyear;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.FUNDA_CLEAN created, with 181286 rows and 122 columns.

1316  run;
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.
1317  
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.27 seconds
      cpu time            0.26 seconds
      

1318  data StateName;
1319      set rawdata.firmStateName;
1320  run;

NOTE: There were 41696 observations read from the data set RAWDATA.FIRMSTATENAME.
NOTE: The data set WORK.STATENAME has 41696 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.00 seconds
      

1321  
1322  proc sql;
1323      create table Analysis as
1324      select a.*,b.*,
1325             c.StateName label="Firm HQ State", c.ST label="State",
1326             d.at, d.at_l, d.sale, d.sale_l, d.ni, d.ib, d.ibc, d.firm_age,
1327             d.ind_mean_firm_age, d.ind_std_firm_age, d.ind_med_firm_age,
1328             d.revt, d.revt_l, d.ceq, d.datadate as datadate_ann, d.xrd,
1329             d.epspx_std_10, d.epsfx_std_10, d.eps_std_10,
1330             d.intan1, d.intan2, d.intan3,
1331             d.oancf_std_10
1332      from   Analysis as a
1333      left   join fundq_clean as b
1334             on a.gvkey=b.gvkey and a.rdq=b.rdq
1335      left   join StateName as c
1336             on a.gvkey=c.gvkey
1337      left   join funda_clean as d
1338             on a.gvkey=d.gvkey and a.fyearq=d.fyear ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable fyearq already exists on file WORK.ANALYSIS.
WARNING: Variable fqtr already exists on file WORK.ANALYSIS.
WARNING: Variable fyr already exists on file WORK.ANALYSIS.
WARNING: Variable rdq already exists on file WORK.ANALYSIS.
WARNING: Variable dlcq already exists on file WORK.ANALYSIS.
WARNING: Variable dlttq already exists on file WORK.ANALYSIS.
WARNING: Variable ibq already exists on file WORK.ANALYSIS.
WARNING: Variable ltq already exists on file WORK.ANALYSIS.
WARNING: Variable niq already exists on file WORK.ANALYSIS.
WARNING: Variable oiadpq already exists on file WORK.ANALYSIS.
WARNING: Variable oibdpq already exists on file WORK.ANALYSIS.
WARNING: Variable ppegtq already exists on file WORK.ANALYSIS.
WARNING: Variable saleq already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 50545 rows and 361 columns.

1339  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.25 seconds
      cpu time            2.82 seconds
      

1340  
1341  proc sql;
1342      create table Analysis as
1343      select  *,
1344              max(firm_age) as firm_age2
1345      from    Analysis
1346      group by cid, gvkey, year(datadate)
1347      order by cid, pairid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 50545 rows and 362 columns.

1348  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.29 seconds
      cpu time            1.57 seconds
      

1349  * mean and median by cohort;
1350  proc sql;
1351      create table Analysis as
1352      select  *,
1353              mean(firm_age) as ind_mean_firm_age2 label="Industry mean firm age",
1354              median(firm_age) as ind_med_firm_age2 label="Industry median firm age",
1355              std(firm_age) as ind_std_firm_age2 label="Industry Std firm age"
1356      from    Analysis
1357      group by cid, sic2
1358      order by cid, pairid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 50545 rows and 365 columns.

1359  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.27 seconds
      cpu time            1.65 seconds
      

1360  
1361  
1362  * Reconcile dates for Sibel tests ;
1363  data Analysis; set Analysis;
1364      calyear = year(datadate_ann);
1365      if calyear = . then calyear = year(fqenddt);
1366      calqtr = qtr(datadate);
1367  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      3545 at 1364:15   126 at 1365:35    
NOTE: There were 50545 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 50545 observations and 367 variables.
NOTE: DATA statement used (Total process time):
      real time           0.32 seconds
      cpu time            0.32 seconds
      

1368  
1369  * average inst ownership over the fiscal year;
1370  proc sql;
1371      create table Analysis as
1372      select *,
1373             avg(ior) as avg_ior label="Average Qtr IOR" format comma8.4
1374      from   Analysis
1375      group  by gvkey, fyearq
1376      order  by cid, gvkey, rdq;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 50545 rows and 368 columns.

1377  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.32 seconds
      cpu time            1.64 seconds
      

1378  data Analysis;
1379      retain gvkey fyearq fqtr rdq datadate ANNOUNCE_DATE treated post qd_rel cid pairid qd;
1380      set Analysis;
1381      if cmiss (of relstkpick1 ) eq 0;
1382  run;

NOTE: There were 50545 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32928 observations and 368 variables.
NOTE: DATA statement used (Total process time):
      real time           0.26 seconds
      cpu time            0.26 seconds
      

1383  
1384  
1385  /* ************************************************************************ */
1386  * make some vars to check the number of non-missing Relstkpick ;
1387  /* ************************************************************************ */
1388  * COUNTER is a cummulative number: 0,1,2,3,4,5 ;
1389  proc sort data=Analysis; by cid gvkey post; run;

NOTE: There were 32928 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32928 observations and 368 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.34 seconds
      cpu time            0.34 seconds
      

1390  data Analysis;
1391      set Analysis;
1392      by cID gvkey post;
1393      if first.post then COUNTER=0;
1394      COUNTER+(Relstkpick1 ne .);
1395  run;

NOTE: There were 32928 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32928 observations and 369 variables.
NOTE: DATA statement used (Total process time):
      real time           0.21 seconds
      cpu time            0.21 seconds
      

1396  
1397  proc sql;
1398      * get the max number of obs in the PRE- and POST-period;
1399      create table Analysis as
1400      select *,
1401             max(COUNTER) as COUNTER_BY_POST
1402      from   Analysis
1403      group  by cID, gvkey, post
1404      order  by cid, gvkey, qd_rel ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32928 rows and 370 columns.

1405  
1406      create table Analysis as
1407      select *,
1408             min(post) as MIN_POST,
1409             max(post) as MAX_POST,
1410             min(COUNTER_BY_POST) as MIN_NOBS_PRE_POST
1411      from   Analysis
1412      group  by cID, gvkey
1413      order  by cid, gvkey, qd_rel ;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32928 rows and 373 columns.

1414  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.41 seconds
      cpu time            1.86 seconds
      

1415  proc sort data=Analysis ; by cID PairID treated gvkey datadate; run;

NOTE: There were 32928 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32928 observations and 373 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.42 seconds
      cpu time            0.40 seconds
      

1416  
1417  * drop duplicates;
1418  proc sort data=Analysis nodupkey; by cID treated gvkey datadate; run;

NOTE: There were 32928 observations read from the data set WORK.ANALYSIS.
NOTE: 456 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 32472 observations and 373 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.41 seconds
      cpu time            0.42 seconds
      

1419  
1420  * destring SIC;
1421  data Analysis;  set Analysis;   sic_num = input(sic, 8.); label sic_num="Standard Industry
1421! Classification Code"; drop sic; run;

NOTE: There were 32472 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32472 observations and 372 variables.
NOTE: DATA statement used (Total process time):
      real time           0.27 seconds
      cpu time            0.28 seconds
      

1422  data Analysis;  set Analysis;   rename sic_num = sic; run;

NOTE: There were 32472 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32472 observations and 372 variables.
NOTE: DATA statement used (Total process time):
      real time           0.27 seconds
      cpu time            0.28 seconds
      

1423  
1424  * Sort again to get the original order;
1425  proc sort data=Analysis nodupkey; by cid gvkey datadate; run;

NOTE: There were 32472 observations read from the data set WORK.ANALYSIS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 32472 observations and 372 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.41 seconds
      cpu time            0.42 seconds
      

1426  
1427  
1428  /* ************************************************************************ */
1429  /* ***********************  PART 4: ADDITIONAL DATA  ********************** */
1430  /* ************************************************************************ */
1431  * Analyst forecast and Analyst following;
1432  data afc; set rawdata.afc_fundq;
1433      keep gvkey fyearq datadate rdq numest lnanalys repdats ryear ;
1434      lnanalys = log(1+numest);
1435      if lnanalys ne . ;
1436      ryear = year(repdats);
1437  run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      480890 at 1434:16   480890 at 1434:21   
NOTE: There were 988699 observations read from the data set RAWDATA.AFC_FUNDQ.
NOTE: The data set WORK.AFC has 507809 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           0.41 seconds
      cpu time            0.12 seconds
      

1438  proc sort data=afc nodupkey ; by gvkey repdats; run;

NOTE: There were 507809 observations read from the data set WORK.AFC.
NOTE: 1183 observations with duplicate key values were deleted.
NOTE: The data set WORK.AFC has 506626 observations and 8 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.05 seconds
      cpu time            0.12 seconds
      

1439  
1440  proc sql;
1441      create table afc as
1442      select distinct gvkey, ryear, datadate,
1443             max(numest) as numest_max label="Max #Analyst (year)",
1444             max(lnanalys) as lnanalys_max label="Max #LnAnalyst (year)"
1445      from   afc
1446      group  by gvkey, ryear
1447      order  by gvkey, datadate;
NOTE: The query requires remerging summary statistics back with the original data.
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.AFC created, with 506626 rows and 5 columns.

1448  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.18 seconds
      cpu time            0.26 seconds
      

1449  
1450  * Stock illiquidity (AIM);
1451  data aim; set rawdata.aim; run;

NOTE: There were 649518 observations read from the data set RAWDATA.AIM.
NOTE: The data set WORK.AIM has 649518 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.17 seconds
      cpu time            0.03 seconds
      

1452  proc sort data=aim nodupkey; by gvkey datadate; run;

NOTE: There were 649518 observations read from the data set WORK.AIM.
NOTE: 374 observations with duplicate key values were deleted.
NOTE: The data set WORK.AIM has 649144 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.12 seconds
      

1453  
1454  * Price synchronicity (Morck et al 2002);
1455  data psynch ; set rawdata.pinfo_qtr_retx6d; run;

NOTE: There were 515792 observations read from the data set RAWDATA.PINFO_QTR_RETX6D.
NOTE: The data set WORK.PSYNCH has 515792 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.14 seconds
      cpu time            0.01 seconds
      

1456  proc sort data=psynch; by gvkey fyear fqtr; run;

NOTE: There were 515792 observations read from the data set WORK.PSYNCH.
NOTE: The data set WORK.PSYNCH has 515792 observations and 9 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.12 seconds
      

1457  
1458  data psynch; set psynch;
1459      by gvkey fyear fqtr;
1460      if last.fqtr;
1461  run;

NOTE: There were 515792 observations read from the data set WORK.PSYNCH.
NOTE: The data set WORK.PSYNCH has 515774 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds
      

1462  
1463  * Bushee's IICLASS data;
1464  data io_class;
1465      set rawdata.io_class2022qtr;
1466      rqtr = qtr(rdate);
1467      ryear = year(rdate);
1468  run;

NOTE: There were 737259 observations read from the data set RAWDATA.IO_CLASS2022QTR.
NOTE: The data set WORK.IO_CLASS has 737259 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.25 seconds
      cpu time            0.07 seconds
      

1469  
1470  * Financial constraints;
1471  data constraints; set rawdata.constraints; run;

NOTE: There were 162789 observations read from the data set RAWDATA.CONSTRAINTS.
NOTE: The data set WORK.CONSTRAINTS has 162789 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds
      

1472  
1473  * opacity;
1474  data AFERR;
1475      set rawdata.AFERR_062525;
1476      fpeyear = year(FPEDATS);
1477      drop fyear;
1478  run;

NOTE: There were 122937 observations read from the data set RAWDATA.AFERR_062525.
NOTE: The data set WORK.AFERR has 122937 observations and 14 variables.
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.01 seconds
      

1479  proc sort data=AFERR nodupkey; by gvkey fpeyear; run;

NOTE: There were 122937 observations read from the data set WORK.AFERR.
NOTE: 12 observations with duplicate key values were deleted.
NOTE: The data set WORK.AFERR has 122925 observations and 14 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.02 seconds
      cpu time            0.03 seconds
      

1480  data AFERR; set AFERR; drop fpeyear; run;

NOTE: There were 122925 observations read from the data set WORK.AFERR.
NOTE: The data set WORK.AFERR has 122925 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1481  
1482  * Ivol quarterly;
1483  data retvol;
1484      set rawdata.retvol_070725;
1485      rename rdq = enddt;
1486      keep gvkey rdq vol0 vol1;
1487  run;

NOTE: There were 476412 observations read from the data set RAWDATA.RETVOL_070725.
NOTE: The data set WORK.RETVOL has 476412 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.10 seconds
      cpu time            0.00 seconds
      

1488  proc sort data=retvol nodupkey; by gvkey enddt; run;

NOTE: There were 476412 observations read from the data set WORK.RETVOL.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.RETVOL has 476412 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.06 seconds
      

1489  
1490  * Abnormal trading volume;
1491  data abvolume; set rawdata.abvolume; run;

NOTE: There were 747275 observations read from the data set RAWDATA.ABVOLUME.
NOTE: The data set WORK.ABVOLUME has 747275 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.14 seconds
      cpu time            0.01 seconds
      

1492  proc sort data=abvolume nodupkey; by gvkey fyearq fqtr; run;

NOTE: There were 747275 observations read from the data set WORK.ABVOLUME.
NOTE: 29080 observations with duplicate key values were deleted.
NOTE: The data set WORK.ABVOLUME has 718195 observations and 6 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.14 seconds
      

1493  
1494  * CAR at meeting dates to activism data;
1495  data car_meetingdt1;
1496      set rawdata.car_meetingdt_capm_00;
1497      rename car = car_meeting00;
1498      label car = "AR[0] Meeting dt";
1499  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_00.
NOTE: The data set WORK.CAR_MEETINGDT1 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1500  proc sort data=car_meetingdt1 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT1.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT1 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1501  
1502  data car_meetingdt2;
1503      set rawdata.car_meetingdt_capm_01;
1504      rename car = car_meeting01;
1505      label car = "CAR[0+1] Meeting dt";
1506  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_01.
NOTE: The data set WORK.CAR_MEETINGDT2 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1507  proc sort data=car_meetingdt2 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT2.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT2 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1508  
1509  data car_meetingdt3;
1510      set rawdata.car_meetingdt_capm_11_round2;
1511      rename car = car_meeting11;
1512      label car = "CAR[-1+1] Meeting dt";
1513  run;

NOTE: There were 1846 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_11_ROUND2.
NOTE: The data set WORK.CAR_MEETINGDT3 has 1846 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1514  proc sort data=car_meetingdt3 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1846 observations read from the data set WORK.CAR_MEETINGDT3.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT3 has 1846 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1515  
1516  data car_meetingdt4;
1517      set rawdata.car_meetingdt_capm_17;
1518      rename car = car_meeting17;
1519      label car = "CAR[+1+7] Meeting dt";
1520  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_17.
NOTE: The data set WORK.CAR_MEETINGDT4 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1521  proc sort data=car_meetingdt4 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT4.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT4 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1522  
1523  data car_meetingdt5;
1524      set rawdata.car_meetingdt_capm_27_round2;
1525      rename car = car_meeting27;
1526      label car = "CAR[+2+7] Meeting dt";
1527  run;

NOTE: There were 1846 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_27_ROUND2.
NOTE: The data set WORK.CAR_MEETINGDT5 has 1846 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1528  proc sort data=car_meetingdt5 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1846 observations read from the data set WORK.CAR_MEETINGDT5.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT5 has 1846 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1529  
1530  data car_meetingdt6;
1531      set rawdata.car_meetingdt_capm_214;
1532      rename car = car_meeting214;
1533      label car = "CAR[+2+14] Meeting dt";
1534  run;

NOTE: There were 1826 observations read from the data set RAWDATA.CAR_MEETINGDT_CAPM_214.
NOTE: The data set WORK.CAR_MEETINGDT6 has 1826 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1535  proc sort data=car_meetingdt6 nodupkey; by pairid treated gvkey ANNOUNCE_DATE ; run;

NOTE: There were 1826 observations read from the data set WORK.CAR_MEETINGDT6.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.CAR_MEETINGDT6 has 1826 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1536  
1537  * compute the sum of Large and Small MFOR immediately before 13D;
1538  data mfor_13d; set rawdata.mfor_13d; run;

NOTE: There were 856 observations read from the data set RAWDATA.MFOR_13D.
NOTE: The data set WORK.MFOR_13D has 856 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1539  proc sort data=mfor_13d nodupkey; by gvkey CAMPAIGN_ID; run;

NOTE: There were 856 observations read from the data set WORK.MFOR_13D.
NOTE: 4 observations with duplicate key values were deleted.
NOTE: The data set WORK.MFOR_13D has 852 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1540  
1541  * Investor Relation (IR) data;
1542  data ir;  set rawdata.ir2_061725_ext_pre; run;

NOTE: There were 90368 observations read from the data set RAWDATA.IR2_061725_EXT_PRE.
NOTE: The data set WORK.IR has 90368 observations and 32 variables.
NOTE: DATA statement used (Total process time):
      real time           0.08 seconds
      cpu time            0.00 seconds
      

1543  data ir_cp; set rawdata.ir2_022225_cp; run;

NOTE: There were 124238 observations read from the data set RAWDATA.IR2_022225_CP.
NOTE: The data set WORK.IR_CP has 124238 observations and 36 variables.
NOTE: DATA statement used (Total process time):
      real time           0.14 seconds
      cpu time            0.04 seconds
      

1543!                                                 * event type to "CP" only ;
1544  data ir_cs; set rawdata.ir2_022225_cs; run;

NOTE: There were 21768 observations read from the data set RAWDATA.IR2_022225_CS.
NOTE: The data set WORK.IR_CS has 21768 observations and 36 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds
      

1544!                                                 * event type to "CS" only ;
1545  data ir_cpcs; set rawdata.ir2_022225_cpcs; run;

NOTE: There were 132403 observations read from the data set RAWDATA.IR2_022225_CPCS.
NOTE: The data set WORK.IR_CPCS has 132403 observations and 36 variables.
NOTE: DATA statement used (Total process time):
      real time           0.15 seconds
      cpu time            0.01 seconds
      

1545!                                                 * event type to "CP,CS" only;
1546  
1547  * add the IR frequency where we restrict the event_type to CP only;
1548  proc sql;
1549      create table ir as
1550      select
1551          a.*,
1552          b.ir_dum as ir_dum_cp, b.ir_freq_adj_cp, b.ir_freq_adj_cp3, b.ir_freq_adj_cp5,
1552! b.ir_freq_adj_cp7,
1553          c.ir_dum as ir_dum_cs, c.ir_freq_adj_cs, c.ir_freq_adj_cs3, c.ir_freq_adj_cs5,
1553! c.ir_freq_adj_cs7,
1554          d.ir_dum as ir_dum_cpcs, d.ir_freq_adj_cpcs, d.ir_freq_adj_cpcs3,
1554! d.ir_freq_adj_cpcs5,
1555          d.ir_freq_adj_cpcs7, d.ir_freq as ir_freq_cpcs
1556      from ir as a
1557      left join ir_cp as b on a.gvkey=b.gvkey and a.qd=b.qd
1558      left join ir_cs as c on a.gvkey=c.gvkey and a.qd=c.qd
1559      left join ir_cpcs as d on a.gvkey=d.gvkey and a.qd=d.qd ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.IR created, with 90368 rows and 48 columns.

1560  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.20 seconds
      cpu time            0.21 seconds
      

1561  proc sort data=ir ; by gvkey year date; run;

NOTE: There were 90368 observations read from the data set WORK.IR.
NOTE: The data set WORK.IR has 90368 observations and 48 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.04 seconds
      

1562  
1563  * experience level of proxy solicitors;
1564  data advisory; set rawdata.advisory_061725; run;

NOTE: There were 550 observations read from the data set RAWDATA.ADVISORY_061725.
NOTE: The data set WORK.ADVISORY has 550 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1565  proc sort data=advisory nodupkey; by CAMPAIGN_ID; run;

NOTE: There were 550 observations read from the data set WORK.ADVISORY.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ADVISORY has 550 observations and 13 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1566  
1567  * Insider Ownership  ;
1568  data insider; set rawdata.insider_061725; run;

NOTE: There were 48632 observations read from the data set RAWDATA.INSIDER_061725.
NOTE: The data set WORK.INSIDER has 48632 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1569  
1570  * Solicitor rank
1571  data solicitor_rank; set rawdata.solicitor_rank;
                           ---
                           180

ERROR 180-322: Statement is not valid or it is used out of proper order.

1572  proc sort nodupkey; by CAMPAIGN_ID; run;
ERROR: Variable CAMPAIGN_ID not found.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      
1573  
1574  * Voting Analytics data ;


1575  data vote;  set rawdata.vavote; keep CAMPAIGN_ID meetingtype meetingid ; run;

NOTE: There were 20101 observations read from the data set RAWDATA.VAVOTE.
NOTE: The data set WORK.VOTE has 20101 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.00 seconds
      

1576  proc sort data=vote nodupkey; by CAMPAIGN_ID meetingtype meetingid ; run;

NOTE: There were 20101 observations read from the data set WORK.VOTE.
NOTE: 18299 observations with duplicate key values were deleted.
NOTE: The data set WORK.VOTE has 1802 observations and 3 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1577  
1578  * Quarterly Analyst following;
1579  data analyst_following_qtr; set rawdata.analyst_following_qtr;rename rdq=enddt;run;

NOTE: There were 123808 observations read from the data set RAWDATA.ANALYST_FOLLOWING_QTR.
NOTE: The data set WORK.ANALYST_FOLLOWING_QTR has 123808 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1580  proc sort nodupkey data=analyst_following_qtr; by gvkey enddt; run;

NOTE: There were 123808 observations read from the data set WORK.ANALYST_FOLLOWING_QTR.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYST_FOLLOWING_QTR has 123808 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1581  data activist_exp_scaled; set rawdata.activist_exp_scaled;  run;

NOTE: There were 9262 observations read from the data set RAWDATA.ACTIVIST_EXP_SCALED.
NOTE: The data set WORK.ACTIVIST_EXP_SCALED has 9262 observations and 27 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

1582  proc sort nodupkey data=activist_exp_scaled; by CAMPAIGN_ID; run;

NOTE: There were 9262 observations read from the data set WORK.ACTIVIST_EXP_SCALED.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ACTIVIST_EXP_SCALED has 9262 observations and 27 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1583  
1584  * entrenchment index (E-index) ;
1585  data e_index;set rawdata.e_index;run;

NOTE: There were 78600 observations read from the data set RAWDATA.E_INDEX.
NOTE: The data set WORK.E_INDEX has 78600 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1586  proc sort nodupkey data=e_index; by gvkey year quarter; run;

NOTE: There were 78600 observations read from the data set WORK.E_INDEX.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.E_INDEX has 78600 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1587  
1588  * RMGovernance Entrenchment index (E-index2) ;
1589  data e_index2;set rawdata.e_index2;run;

NOTE: There were 23698 observations read from the data set RAWDATA.E_INDEX2.
NOTE: The data set WORK.E_INDEX2 has 23698 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1590  proc sort nodupkey data=e_index; by gvkey year; run;

NOTE: There were 78600 observations read from the data set WORK.E_INDEX.
NOTE: 57806 observations with duplicate key values were deleted.
NOTE: The data set WORK.E_INDEX has 20794 observations and 4 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1591  
1592  * activist prior experience ;
1593  data activist_exp_ts;set rawdata.activist_exp_ts;run;

NOTE: There were 3793 observations read from the data set RAWDATA.ACTIVIST_EXP_TS.
NOTE: The data set WORK.ACTIVIST_EXP_TS has 3793 observations and 19 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1594  proc sort nodupkey data=activist_exp_ts; by CAMPAIGN_ID; run;

NOTE: There were 3793 observations read from the data set WORK.ACTIVIST_EXP_TS.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.ACTIVIST_EXP_TS has 3793 observations and 19 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

1595  
1596  * Insider Ownership based on executive-level sharesowned ;
1597  data beneown_agg2;set rawdata.beneown_agg2;run;

NOTE: There were 39996 observations read from the data set RAWDATA.BENEOWN_AGG2.
NOTE: The data set WORK.BENEOWN_AGG2 has 39996 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1598  proc sort nodupkey data=beneown_agg2; by gvkey FISCALYEAR ; run;

NOTE: There were 39996 observations read from the data set WORK.BENEOWN_AGG2.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.BENEOWN_AGG2 has 39996 observations and 7 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

1599  
1600  * MFF holding value ;
1601  data holdingvalue;set rawdata.holdingvalue; run;

NOTE: There were 253907 observations read from the data set RAWDATA.HOLDINGVALUE.
NOTE: The data set WORK.HOLDINGVALUE has 253907 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      

1602  
1603  
1604  * ---------------------------------------------------------------------------;
1605  * Merge the final data with other datasets;
1606  * ---------------------------------------------------------------------------;
1607  proc sql;
1608  create table Analysis as
1609  select  a.*, b.*
1610  from    Analysis as a left join afc as b
1611  on      a.gvkey=b.gvkey and a.datadate = b.datadate ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable ryear already exists on file WORK.ANALYSIS.
WARNING: Variable datadate already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 374 columns.

1612  
1613  create table Analysis as
1614  select  a.*, b.insider_own
1615  from    Analysis as a left join insider as b
1616  on      a.gvkey=b.gvkey and a.datadate = b.datadate ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 375 columns.

1617  
1618  create table Analysis as
1619  select  a.*, b.aim, b.ln_oneplusaim, b.ln_aim
1620  from    Analysis as a left join aim as b
1621  on      a.gvkey=b.gvkey and a.datadate = b.datadate;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 378 columns.

1622  
1623  create table Analysis as
1624  select  a.*, b.psynch1,b.psynch2,b.psynch3,b.pinfo1,b.pinfo2,b.pinfo3
1625  from    Analysis as a left join psynch as b
1626  on      a.gvkey=b.gvkey and a.fyearq = b.fyear and a.fqtr=b.fqtr ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 384 columns.

1627  
1628  create table Analysis as
1629  select  a.*, b.*
1630  from    Analysis as a left join io_class as b
1631  on      a.gvkey=b.gvkey and a.fyearq=b.ryear and a.fqtr=b.rqtr ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable permno already exists on file WORK.ANALYSIS.
WARNING: Variable rdate already exists on file WORK.ANALYSIS.
WARNING: Variable ryear already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 393 columns.

1632  
1633  create table Analysis as
1634  select  a.*, b.kzindex,b.saindex,b.wwindex
1635  from    Analysis as a left join constraints as b
1636  on      a.gvkey=b.gvkey and a.fyearq=b.fyear+1  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 396 columns.

1637  
1638  create table Analysis as
1639  select  a.*, b.abvolume, b.volumeturn
1640  from    Analysis as a left join abvolume as b
1641  on      a.gvkey=b.gvkey and a.fyearq=b.fyearq and a.fqtr=b.fqtr;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 398 columns.

1642  
1643  create table Analysis as
1644  select  a.*, b.vol0, b.vol1
1645  from    Analysis as a left join retvol as b
1646  on      a.gvkey=b.gvkey and a.rdq=b.enddt ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 400 columns.

1647  
1648  create table Analysis as
1649  select  a.*, b.car_meeting00
1650  from    Analysis as a left join car_meetingdt1 as b
1651  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 401 columns.

1652  
1653  create table Analysis as
1654  select  a.*, b.car_meeting01
1655  from    Analysis as a left join car_meetingdt2 as b
1656  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 402 columns.

1657  
1658  create table Analysis as
1659  select  a.*, b.car_meeting11
1660  from    Analysis as a left join car_meetingdt3 as b
1661  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 403 columns.

1662  
1663  create table Analysis as
1664  select  a.*, b.car_meeting17
1665  from    Analysis as a left join car_meetingdt4 as b
1666  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 404 columns.

1667  
1668  create table Analysis as
1669  select  a.*, b.car_meeting27
1670  from    Analysis as a left join car_meetingdt5 as b
1671  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 405 columns.

1672  
1673  create table Analysis as
1674  select  a.*, b.car_meeting214
1675  from    Analysis as a left join car_meetingdt6 as b
1676  on      a.gvkey=b.gvkey and a.pairid=b.pairid  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 406 columns.

1677  
1678  create table Analysis as
1679  select  a.*, b.*
1680  from    Analysis as a left join AFERR as b
1681  on      a.gvkey=b.gvkey and
1682          year(a.datadate)=year(b.FPEDATS) ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 32472 rows and 418 columns.

1683  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           7.66 seconds
      cpu time            8.50 seconds
      

1684  
1685  proc sort data=Analysis nodupkey; by cid gvkey rdq; run;

NOTE: There were 32472 observations read from the data set WORK.ANALYSIS.
NOTE: 49 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 32423 observations and 418 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.42 seconds
      cpu time            0.42 seconds
      

1686  
1687  * Merge more variables ;
1688  proc sql;
1689  create table Analysis as
1690  select  a.*, b.*
1691  from    Analysis as a left join mfor_13d as b
1692  on      a.gvkey=b.gvkey and a.CAMPAIGN_ID=b.CAMPAIGN_ID ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable gvkey already exists on file WORK.ANALYSIS.
WARNING: Variable campaign_id already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 32423 rows and 426 columns.

1693  
1694  create table Analysis as
1695  select  a.*, b.*
1696  from    Analysis as a left join advisory as b
1697  on      a.CAMPAIGN_ID=b.CAMPAIGN_ID ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
WARNING: Variable CAMPAIGN_ID already exists on file WORK.ANALYSIS.
NOTE: Table WORK.ANALYSIS created, with 32423 rows and 438 columns.

1698  
1699  create table Analysis as
1700  select  a.*, b.date as ir_date,
1701          b.ir_freq, b.ir_dum, b.ir_avg_last4, b.ir_avg_last6,
1702          b.ir_avg_last8, b.ir_avg_last10, b.ir_avg_last12, b.ir_avg_last16,
1703          b.ir_dum_cpcs, b.ir_freq_adj_cpcs, b.ir_freq_adj_cpcs3,
1704          b.ir_freq_adj_cpcs5, b.ir_freq_adj_cpcs7, ir_freq_cpcs
1705  from    Analysis as a left join ir as b
1706  on      a.gvkey=b.gvkey and
1707          a.fyearq=b.year and a.fqtr=b.quarter;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32532 rows and 453 columns.

1708  
1709  create table Analysis as
1710  select  a.*, b.have_ir_88
1711  from    Analysis as a left join
1712          (select distinct gvkey, qd_0_win, have_ir_88 from ir
1713          where have_ir_88 ne . )  as b
1714  on      a.gvkey=b.gvkey and a.qd_0 = b.qd_0_win ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32532 rows and 454 columns.

1715  
1716  create table Analysis as
1717  select  a.*, b.have_ir_66
1718  from    Analysis as a left join
1719          (select distinct gvkey, qd_0_win, have_ir_66 from ir
1720          where have_ir_66 ne . )  as b
1721  on      a.gvkey=b.gvkey and a.qd_0 = b.qd_0_win ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32532 rows and 455 columns.

1722  
1723  create table Analysis as
1724  select  a.*, b.have_ir_44
1725  from    Analysis as a left join
1726          (select distinct gvkey, qd_0_win, have_ir_44 from ir
1727          where have_ir_44 ne . )  as b
1728  on      a.gvkey=b.gvkey and a.qd_0 = b.qd_0_win ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32532 rows and 456 columns.

1729  
1730  create table Analysis as
1731  select  a.*, b.have_ir_1010
1732  from    Analysis as a left join
1733          (select distinct gvkey, qd_0_win, have_ir_1010 from ir
1734          where have_ir_1010 ne . )  as b
1735  on      a.gvkey=b.gvkey and a.qd_0 = b.qd_0_win ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32532 rows and 457 columns.

1736  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.63 seconds
      cpu time            4.14 seconds
      

1737  
1738  proc sql;
1739  create table Analysis as
1740  select  a.*,
1741          b.Desc_Rank_solicitor_com_side,
1742          b.Desc_Rank_solicitor_com_side2,
1743          b.Desc_Rank_solicitor_com_side3,
1744          b.top_solicitor_agg
1745  from    Analysis as a left join solicitor_rank as b
1746  on      a.CAMPAIGN_ID = b.CAMPAIGN_ID ;
ERROR: File WORK.SOLICITOR_RANK.DATA does not exist.
1747  
1748  create table Analysis as
1749  select  a.*,
1750          b.meetingtype label="ISS Voting Type",
1751          b.meetingid label="ISS MeetingID"
1752  from    Analysis as a left join vote as b
1753  on      a.CAMPAIGN_ID = b.CAMPAIGN_ID  ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32554 rows and 459 columns.

1754  
1755  create table Analysis as
1756  select  a.*,
1757          b.firm_prior_exp,
1758          b.n_events_3yr_sum as n_events_3yr_sum_firm,
1759          b.n_events_4yr_sum as n_events_4yr_sum_firm,
1760          b.n_events_5yr_sum as n_events_5yr_sum_firm,
1761          b.n_events_10yr_sum as n_events_10yr_sum_firm
1762  from    Analysis as a left join activist_exp_scaled as b
1763  on      a.CAMPAIGN_ID = b.CAMPAIGN_ID ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32554 rows and 464 columns.

1764  
1765  create table Analysis as
1766  select  a.*,
1767          b.n_events_current,
1768          b.n_events_2yr_sum,
1769          b.n_events_3yr_sum,
1770          b.n_events_4yr_sum,
1771          b.n_events_5yr_sum,
1772          b.n_events_6yr_sum,
1773          b.n_events_10yr_sum,
1774          b.cum_n_events,
1775          b.adj_n_events_3yr_sum,
1776          b.adj_n_events_4yr_sum,
1777          b.adj_n_events_5yr_sum,
1778          b.adj_n_events_10yr_sum,
1779          b.adj_cum_n_events,
1780          b.rel_threat
1781  from    Analysis as a left join activist_exp_ts as b
1782  on      a.CAMPAIGN_ID = b.CAMPAIGN_ID ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32554 rows and 478 columns.

1783  
1784  create table Analysis as
1785  select  a.*, b.e_index
1786  from    Analysis as a left join e_index as b
1787  on      a.gvkey=b.gvkey and
1788          a.fyearq=b.year and a.fqtr=b.quarter;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32554 rows and 479 columns.

1789  
1790  create table Analysis as
1791  select  a.*, b.e_index2, b.e_index3, b.e_index4
1792  from    Analysis as a left join e_index2 as b
1793  on      a.gvkey=b.gvkey and
1794          a.fyearq=b.year ;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32554 rows and 482 columns.

1795  
1796  create table Analysis as
1797  select  a.*, b.totalholdingval
1798  from    Analysis as a left join holdingvalue as b
1799  on      a.gvkey=b.gvkey and
1800          a.rdq=b.rdq;
WARNING: This CREATE TABLE statement recursively references the target table. A consequence of 
         this is a possible data integrity problem.
NOTE: Table WORK.ANALYSIS created, with 32554 rows and 483 columns.

1801  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.98 seconds
      cpu time            3.46 seconds
      
1802  
1803  * House cleaning and export data;


1804  proc sort data=Analysis nodupkey; by cid gvkey rdq; run;

NOTE: There were 32554 observations read from the data set WORK.ANALYSIS.
NOTE: 131 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANALYSIS has 32423 observations and 483 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.43 seconds
      cpu time            0.43 seconds
      

1805  
1806  ** drop unwanted vars;
1807  data Analysis ;
1808  set Analysis;
1809  drop outcome_desc company_fee_desc dissident_fee_desc dir_off_own_desc campaign_synopsis
1809! campaign_title iso_country
1810  targetname: targetfin: targetlegal: targetpr1 targetpr2 targetpr3  actfinanc: actlegal:
1810! actpr: targetproxy2 targetproxy3 ;
1811  run;

NOTE: There were 32423 observations read from the data set WORK.ANALYSIS.
NOTE: The data set WORK.ANALYSIS has 32423 observations and 441 variables.
NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.20 seconds
      

1812  
1813  * Export data to Stata file;
1814  %let FFP =
1814! "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance\assembledd
1814! ata.dta";
1815  proc export data = Analysis outfile = &FFP. replace;
1815!                                                      run;

NOTE: The export data set has 32423 observations and 441 variables.
NOTE: "C:\Users\hpham13\Projects\mf_activism\empirical\1_code\final_package_acceptance\assembledd
      ata.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.14 seconds
      cpu time            0.12 seconds
      

1816  
1817  proc printto;
1818  run;

